package entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@NamedNativeQueries({	
	@NamedNativeQuery(name="getSaldos", query = "select * from saldo where id_usuario = :id_usuario ", 
												 resultClass = SaldoENT.class),
	@NamedNativeQuery(name="getSaldo", query = "select * from saldo where id = :id ", 
												 resultClass = SaldoENT.class)										 
})

@Entity
@Table(name="saldo")
public class SaldoENT  implements Serializable{
/*------------------------------------------------------------------------------------*/	
	private static final long serialVersionUID = -808613820685993431L;
	@Id
	@GeneratedValue
	@Column(name="id",nullable = false)
	private int id;	
	
	
	@ManyToOne
	@JoinColumn(name="id_usuario",nullable = false)
	private UsuarioENT idUsuario;
	
	@ManyToOne
	@JoinColumn(name="id_conta_banco",nullable = false)
	private ContaBancoENT idContaBanco;
	
	@Column(name="valor_saldo",nullable = false, length = 4 ,precision = 2)
	private Double vlSaldo;
	
	@Column(name="data_saldo",nullable = false)
	@Temporal(TemporalType.TIMESTAMP)		
	private Date dtSaldo;
	
	@Column(name="descricao",nullable = true)
	private String descricao;
/*------------------------------------------------------------------------------------*/

	public Double getVlSaldo() {
		return vlSaldo;
	}

	public void setVlSaldo(Double vlSaldo) {
		this.vlSaldo = vlSaldo;
	}

	public int getId() {
		return id;
	}

	public UsuarioENT getIdUsuario() {
		return idUsuario;
	}

	public ContaBancoENT getIdContaBanco() {
		return idContaBanco;
	}

	public Date getDtSaldo() {
		return dtSaldo;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setIdUsuario(UsuarioENT idUsuario) {
		this.idUsuario = idUsuario;
	}

	public void setIdContaBanco(ContaBancoENT idContaBanco) {
		this.idContaBanco = idContaBanco;
	}

	public void setDtSaldo(Date dtSaldo) {
		this.dtSaldo = dtSaldo;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}


	
}

